import Vue from "vue";
import VueRouter from "vue-router";

import Home from "../pages/Home";
import Login from "../pages/Login";
import Music from "../pages/Home/Music";
import News from "../pages/Home/News";
import Games from "../pages/Home/Games";

Vue.use(VueRouter);

export default new VueRouter({
  routes: [
    { path: "/login", component: Login, name: "login" },
    {
      path: "/home",
      component: Home,
      name: "home",
      children: [
        {
          path: "music/:id/:time?",
          component: Music,
          name: "music",
          props: true,
        },
        { path: "news", component: News, name: "news" },
        {
          path: "games",
          component: Games,
          name: "games",
          props: (route) => {
            console.log(route, "aaaa");
            return route.query;
          },
        },
      ],
    },
    { path: "/", redirect: "/home" },
  ],
});
